import React from 'react'

interface Props {
  style: React.CSSProperties
  component: React.ComponentType<HeaderProps> 
}

function Welcome(props:Props) {
  return (
    <>
    <h1 style={props.style}>Welcome to React</h1>
    <props.component username="小明" />
    </>
  )
}

interface HeaderProps {
    username:string
}
function Header(props:HeaderProps){
    return (
        <>
            <div> 我是 Header 组件 </div>
            <p>传入的值：{props.username}</p>
        </>
    )
}
export default function StyleCcomponent() {
  return (
    <div>
      style 与 component限制使用
        <Welcome style={{ color: 'blue' }} component={Header} />
    </div>
  )
}
